-
Notifications
You must be signed in to change notification settings - Fork 8k
tests: lib: cpp: cxx: Add test to verify C++ compilation #96944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
38e5a41
to
dcd2b17
Compare
# Verify struct _cpu_arch struct _thread_arch are compatible with C++ when | ||
# specific configs are enabled. | ||
cpp.main.empty_struct_size: | ||
build_only: true | ||
extra_configs: | ||
- CONFIG_USERSPACE=n | ||
- CONFIG_SMP=n | ||
- CONFIG_FPU_SHARING=n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS, this is a RISC-V specific issue; so, this should be limited to arch_allow: riscv
. Also, a RISC-V integration_platforms
should be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like integration_platforms
is not overriding the common
integration_platforms
at the top of the file which causes CI to fail, so I had to leave out arch_allow: riscv
:
INFO: Potential tag based filters: {'kernel', 'cmsis_dsp', 'posix', 'wifi', 'mcumgr', 'bluetooth', 'net', 'test_framework'}
INFO: Potential test filters...(1 changed...)
INFO: /home/runner/work/zephyr/zephyr/zephyr/scripts/twister -c -T tests/lib/cpp/cxx --save-tests _test_plan_partial.json
INFO - Using Ninja..
INFO - Zephyr version: v4.2.0-5093-gc398f976766c
INFO - Using 'zephyr' toolchain.
INFO - Selecting default platforms per testsuite scenario
INFO - Building initial testsuite list...
INFO - Writing JSON report /home/runner/work/zephyr/zephyr/zephyr/twister-out/testplan.json
INFO - Writing JSON report _test_plan_partial.json
INFO: found boards:
INFO: No twister needed or partial twister run only...
INFO: Total tests gathered: 306
INFO: Error found: cpp.main.empty_struct_size on mps2/an385 (Not in testsuite arch allow list but is one of the integration platforms)
INFO: Error found: cpp.main.empty_struct_size on qemu_cortex_a53/qemu_cortex_a53 (Not in testsuite arch allow list but is one of the integration platforms)
INFO: Total tests to be run: 306
INFO: Total nodes to launch: 1
Changed files:
=========
tests/lib/cpp/cxx/testcase.yaml
=========
dcd2b17
to
40409e5
Compare
40409e5
to
34f8b36
Compare
|
When using clang to build for RISC-V with these configs: CONFIG_CPP=y CONFIG_USERSPACE=n CONFIG_SMP=n CONFIG_FPU_SHARING=n we get the following warnings: include/zephyr/arch/riscv/structs.h:11:1: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] 11 | struct _cpu_arch { | ^ include/zephyr/arch/riscv/thread.h:68:1: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] 68 | struct _thread_arch { | ^ This commit adds a test with those configs to verify compilation succeeds. Although gcc doesn't emit these warnings, we can test with gcc as well with a BUILD_ASSERT in include/zephyr/arch/riscv/thread.h and include/zephyr/arch/riscv/structs.h. Signed-off-by: Tom Hughes <[email protected]>
34f8b36
to
2f49f38
Compare
When using clang to build for RISC-V with these configs:
we get the following warnings:
This commit adds a test with those configs to verify compilation
succeeds. Although gcc doesn't emit these warnings, we can test with gcc
as well with a
BUILD_ASSERT
ininclude/zephyr/arch/riscv/thread.h
andinclude/zephyr/arch/riscv/structs.h
that was added in #96943.